package com.star.vrserver.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author star
 * @date 2023-03-11 15:24
 * @Description 配置跨域等问题
 */
@Configuration
public class WebMVCConfig implements WebMvcConfigurer {
    @Value("http://localhost:3000/")
    private String baseUrl;

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**").allowedOrigins(baseUrl);
    }
}
